*! aoeplacebo_examples:	Auxiliary programme to run exmaples for -aoeplacebo-                             
*! Version Beta 1.1:	29/01/2020                                               
*! Author:				Reinhard A. Weisser                                                  
*! 						Nottingham Trent University                               
*! 						reinhard.weisser@ntu.ac.uk                                            
*! Dependencies:		aoeplacebo


********************************************************************************
*** BASIC PROGRAMME															 ***
********************************************************************************

program aoeplacebo_examples
version 15.1
args EXAMPLE
set more off
`EXAMPLE'
end


********************************************************************************
*** AOE PLACEBO EXAMPLE PROGRAMMEs											 ***
********************************************************************************

* Example 1
program aoe_pos_deg_hdfe
aoeplacebo diagnostic, area("observed_area.dta") 								///
	cell("grid_time_incidents.dta") 											///
	estimation(reghdfe I_incident aoe, a(hex_ID mdate))     					///
	method(degree) grid(hex_ID) tid(mdate) etime(op_act) evar(aoe) 				///
	position(1.5 0.5) progress(detail) 											
end

* Example 2
program aoe_pos_deg_log
aoeplacebo diagnostic, area("observed_area.dta") 								///
	cell("grid_time_incidents.dta") 											///
	cellpoly("grid_polygons.dta")												///
	estimation(logit I_incident aoe wave i.mdate, vce(robust))            		/// 
	method(degree) grid(hex_ID) tid(mdate) etime(op_act) evar(aoe) 				///
	position(1.5 0.5) progress(detail) ovreport(wave)    						
end

* Example 3
program aoe_3dim_deg_hdfe
aoeplacebo diagnostic, area("observed_area.dta") 								///
	cell("grid_time_incidents.dta") 											///
	estimation(reghdfe I_incident aoe, a(hex_ID mdate)) 						///
	method(degree) grid(hex_ID) tid(mdate) etime(op_act) evar(aoe) 				///
	position(1.5 0.5) rotation(60 15) scale(2 0.2) progress(detail) 			///
    output("AOE_EXAMPLE", replace) outname(ex3) 
end

* Example 4
program aoe_size_deg_hdfe_vert
aoeplacebo diagnostic, area("observed_area.dta") 								///
	cell("grid_time_incidents.dta") 											///
	estimation(reghdfe I_incident aoe, a(hex_ID mdate)) 						///
	method(degree) grid(hex_ID) tid(mdate) etime(op_act) evar(aoe) 				///
    scale(2 0.2) progress(detail) egrid(vertex) cellpoly("grid_polygons.dta")   ///
    output("AOE_EXAMPLE") outname(ex4)    
end

* Example 5
program aoe_3dim_deg_map
aoeplacebo diagnostic, area("observed_area_60y.dta")                            ///
    cell("grid_time_incidents_60y.dta")                                         ///
	estimation(reghdfe I_incident aoe, a(hex_ID mdate))                  		/// 
	method(degree) grid(hex_ID) tid(mdate) etime(op_act) evar(aoe)      		///  
	position(1.5 0.5) rotation(60 15) scale(2 0.2) progress(detail)             ///
	mapdb("map_db_60y.dta") mapco("map_co_60y.dta")                             ///
	output("AOE_EXAMPLE") outname(ex5)         
end

* Example 6
program aoe_3dim_geo_map
aoeplacebo diagnostic, area("observed_area_60y.dta")                            ///
    cell("grid_time_incidents_60y.dta")                                         ///
	estimation(reghdfe I_incident aoe, a(hex_ID mdate))                  		/// 
	method(geodetic) grid(hex_ID) tid(mdate) etime(op_act) evar(aoe)      		///  
	position(1.5 0.5) rotation(60 15) scale(2 0.2) progress(detail)             ///
	mapdb("map_db_60y.dta") mapco("map_co_60y.dta")                             ///
	output("AOE_EXAMPLE") outname(ex6)         
end

* Example 7
program aoe_3dim_deg_hdfe_complex
aoeplacebo diagnostic, area("observed_area.dta")                                ///
	cell("grid_time_incidents.dta")                                             ///
	estimation(reghdfe I_incident aoe, a(hex_ID mdate))                  		/// 
	method(degree) grid(hex_ID) tid(mdate) etime(op_act) evar(aoe)        		/// 
	complex(L(0/3).aoe F(1/3).aoe c.TS_aoe##c.TS_aoe)   						///
	evreport(c.TS_aoe#c.TS_aoe)                                   				///			 
	position(1.5 0.5) rotation(60 15) scale(2 0.2) progress(detail)             ///
	output("AOE_EXAMPLE") outname(ex7)      
end

* Example 8
program aoe_3dim_tp
aoeplacebo diagnostic, area("observed_area.dta") 								///
	cell("grid_time_incidents.dta") 											///
	estimation(reghdfe I_incident aoe wave, a(hex_ID mdate)) 					///
	method(degree) grid(hex_ID) tid(mdate) etime(op_act) evar(aoe)       		/// 
	complex(L(0/1).aoe c.TS_aoe##c.TS_aoe) evreport(aoe) 						///
    templacebo(-12 6, zero) tempreport(-6 3) ovreport(wave)						///
	position(1.5 0.5) rotation(60 15) scale(2 0.2) progress(detail)             ///
   	output("AOE_EXAMPLE") outname(ex8)      
end

* Example 9
program aoe_3dim_deg_hdfe_multi
aoeplacebo diagnostic, area("observed_area_multi.dta") 							///
	cell("grid_time_incidents.dta") 											///
	estimation(reghdfe I_incident aoe wave, a(hex_ID mdate)) 					///
	method(degree) grid(hex_ID) tid(mdate) etime(op_act) evar(aoe)       	    /// 
	complex(L(0/1).aoe c.TS_aoe##c.TS_aoe) evreport(aoe) 						///
	multi(ea_start ea_end, split)  												///
    position(1 1) rotation(40 40) scale(0.5 1.5 0.5) progress(detail)   		///
	mapdb("map_db.dta") mapco("map_co.dta")                                     ///
   	output("AOE_EXAMPLE") outname(ex9)      
end

* Example 10
program aoe_perm
aoeplacebo permutation, area("observed_area.dta") 								///
	cell("grid_time_incidents.dta") 											///
	estimation(reghdfe I_incident aoe, a(hex_ID mdate)) 				    	///
	method(degree) grid(hex_ID) tid(mdate) etime(op_act) evar(aoe)        		/// 
    complex(L(0/1).aoe c.TS_aoe##c.TS_aoe) evreport(aoe) 						///
    position(2) rotation(45) scale(0.5 1.5)    									///
	replications(5)               											///
	mapdb("map_db.dta") mapco("map_co.dta")                                     ///
    output("AOE_EXAMPLE") outname(ex10) 
end

* Example 11
program aoe_perm_clust
aoeplacebo permutation, area("observed_area.dta") 								///
	cell("grid_time_incidents.dta") 											///
	estimation(reghdfe I_incident aoe, a(hex_ID mdate)) 	    				///
	method(degree) grid(hex_ID) tid(mdate) etime(op_act) evar(aoe)        		/// 
    position(2, uniform) rotation(45, centered) scale(0.5 1.5, centered)    	///
	replications(200) seed(123456789)											///
	mapdb("map_db.dta") mapco("map_co.dta")                                     ///
    output("AOE_EXAMPLE") outname(ex11) 
end

* Example 12
program aoe_perm_restr
aoeplacebo permutation, area("observed_area.dta") 								///
	cell("grid_time_incidents.dta") 											///
	estimation(reghdfe I_incident aoe wave, a(hex_ID mdate)) 					///
	method(degree) grid(hex_ID) tid(mdate) etime(op_act) evar(aoe)        		/// 
    position(2) rotation(45) scale(0.5 1.5)    									///
	replications(200) seed(123456789)											///
	permreport(p=(0 1) r=(0 40) s=(0.75 1.25))                                  ///
	mapdb("map_db.dta") mapco("map_co.dta")                                     ///
    output("AOE_EXAMPLE") outname(ex12) 
end

